package com.itheima.hmshopping.dubbo.apiImpl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.hmshopping.dubbo.api.PmsProductAttributeCategoryApi;
import com.itheima.hmshopping.dubbo.mapper.PmsProductAttributeCategoryMapper;
import com.itheima.hmshopping.entity.PmsProductAttributeCategory;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class PmsProductAttributeCategoryApiImpl implements PmsProductAttributeCategoryApi {

    @Autowired
    private PmsProductAttributeCategoryMapper pmsProductAttributeCategoryMapper;

    /**
     * 分页获取所有商品属性分类
     *
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public Page list(Integer pageNum, Integer pageSize) {
        Page<PmsProductAttributeCategory> page = new Page<>(pageNum, pageSize);
        LambdaQueryWrapper<PmsProductAttributeCategory> queryWrapper = new LambdaQueryWrapper<>();
        Page<PmsProductAttributeCategory> pmsProductAttributePage = pmsProductAttributeCategoryMapper.selectPage(page, queryWrapper);
        return pmsProductAttributePage;
    }


    /**
     * 查询全部商品
     *
     * @return
     */
    @Override
    public List<PmsProductAttributeCategory> findAllAttribute() {
        LambdaQueryWrapper<PmsProductAttributeCategory> queryWrapper = new LambdaQueryWrapper<>();
       return pmsProductAttributeCategoryMapper.selectList(queryWrapper);
    }


    /**
     * 获取所有商品属性分类及其下属性
     * @param productAttributeCategory
     * @param ids
     * @return
     */
}
